#!/usr/bin/env bash
jenkinsHome=""
workspace=""
jarName=""

cd ${jenkinsHome}
cp ${jarName}.jar ${workspace}
cd ${workspace}
if [-e ${jarName}.pid]; then
    pid=$(cat ${jarName}.pid)
    kill -9 pid
    rm -rf ${jarName}.pid
fi
nohup java -jar ${jarName}.jar > ${jarName}.logs &
echo $! > ${jarName}.pid